﻿//
// Created by LiuYou on 2021/4/21.
//

#include <list>
#include <string>

#include <ctime>

// 为了使用扩展的分配器(__gnu_cxx::__pool_alloc<std::string>)(内存池)而导入的头文件
//#include <ext/pool_allocator.h>

#include <iostream>
#include <set>

void testListWithSpecialAllocator() {
    auto timeFlag = std::clock();
//    std::list<std::string, __gnu_cxx::__pool_alloc<std::string>> list;
    std::list<std::string, std::allocator<std::string>> list;
    std::string str[] = {"liu you", "liu You", "C", "C++", "standard", "library", "extend"};
    for (int i = 0; i < str->length(); ++i) {
        list.push_back(str[i]);
    }
    std::cout << "用时: " << std::clock() - timeFlag << std::endl;
    for (const auto& item : list) {
        std::cout << item << std::endl;
    }
    std::multiset<std::string> multiset;
    for (const auto& item : list) {
        multiset.insert(item);
    }
    std::cout << "=========================" << std::endl;
    for (const auto& item : multiset) {
        std::cout << item << std::endl;
    }
}

int main() {
    testListWithSpecialAllocator();


    return 0;
}